<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page contentType="text/html;charset=windows-1252"%>
<%@ taglib uri="/webwork" prefix="ww"%>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"/>
    <title>Credit Card Administration Interface</title>
  </head>
  <body onload="document.newCreditCardForm.newCreditCardName.focus();">
        
  <%@ include file="/admin-header.html" %>

  <h2>Credit Card Administration</h2>

  <form name="updateCreditCardsForm" action="UpdateCreditCards.action" method="post">
    <table border="1">
      <tr>
        <th>Credit Card Name</th>
        <th>Security Code Length</th>
        <th>Valid</th>
        <th>Invalid Date</th>
      </tr>
      <ww:iterator value="allCreditCardsList">
        <tr>
          <td><ww:textfield name="creditCardNameMap[%{id}]" value="%{name}" size ="25" /></td>
          <td><ww:textfield name="securityLengthMap[%{id}]" value="%{securityLength}" size="5"/></td>
          <td><ww:select
              name="creditCardValidMap[%{id}]"
              list="#{\"1\" : 'Valid', \"0\" : 'Discontinued'}"
              value="%{valid.toString()}"
              required="true"
              />
          </td>
          <td><ww:if test="valid == 0" ><ww:property value="%{invalidTimeStamp}" /></ww:if>
                        <ww:else>&nbsp;</ww:else></td>
        </tr>
      </ww:iterator>
    </table>
  <input type="submit" name="UpdateCreditCards" value="Commit changes" />
  </form>

<p/>

<h3>Add New Credit Card</h3>

  <ww:if test="hasActionErrors()" >
    <ul>
      <ww:iterator value="actionErrors">
        <li style="color: red;">
        <ww:property/>
        </li>
      </ww:iterator>
    </ul>
  </ww:if>
  
  <ww:else>
  <form name="newCreditCardForm" action="UpdateCreditCards.action" method="post">

  <table border="1">
    <tr>
      <th>Credit Card Name</th>
      <th>Security Code Length</th>
    </tr>
    <tr>
      <td><ww:textfield size ="25" name="newCreditCardName"/></td>
      <td><ww:textfield size ="35" name="newSecurityLength"/></td>
    </tr>
  </table>
  <input type="submit" name="method:newCreditCard" value="Add new Credit Card" />
  </form>
  </ww:else>
<p/>
<a href="CreditCardAdmin.action">Revert to Saved</a> - 
<a href="LogOut.action">Logout</a>

  </body>
</html>